package cn.bx.spring.print;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;

@Repository("printer")
public class Printer {

    @Value("IBM")
    private String brand;
    @Value("1800")
    private int price;//品牌和价格
    @Resource(name = "color")
    private Ink ink;
    @Resource(name = "b5")
    private TextPaper paper;
    public void print(String s){
        System.out.println("这是一台"+brand+"打印机，价格是："+price+"元");
        System.out.println("用"+ink.getColor()+"墨水来打印：");
        paper.print(s);
    }

   /* public void setBrand(String brand) {
        this.brand = brand;
    }

    public void setPrice(int price) {
        this.price = price;
    }

    public void setInk(Ink ink) {
        this.ink = ink;
    }

    public void setPaper(TextPaper paper) {
        this.paper = paper;
    }*/
}
